﻿


Public Class SfxOptions
    'Shared :
    Public Shared Defaults As SfxOptions
    Shared Sub New()
        Defaults = New SfxOptions
    End Sub
    'Ctor :
    Public Sub New()
        Me.Reset()
    End Sub
    'Fields :
    Public Property Name As String
    Public Property Version As String
    Public Property Copyright As String
    Public Property Description As String

    Public Property Flavor As Zip.SelfExtractorFlavor
    Public Property Quiet As Boolean
    Public Property Title As String
    Public Property IconFile As String

    Public Property CompilerSwitches As String
    Public Property Command As String
    Public Property ExtractExistingAction As Zip.ExtractExistingFileAction
    Public Property RemoveUnpacked As Boolean

    'Routines :
    Public Sub Reset()
        Me.Name = "Zipper"
        Me.Version = "1.0"
        Me.Copyright = "Copyright @ Zipper 2013"
        Me.Description = "Zip Compression Tool"

        Me.Flavor = Zip.SelfExtractorFlavor.ConsoleApplication
        Me.Quiet = False
        Me.Title = Nothing
        Me.IconFile = DefaultSfxIcon()

        Me.CompilerSwitches = Nothing
        Me.Command = Nothing
        Me.ExtractExistingAction = Zip.ExtractExistingFileAction.Throw
        Me.RemoveUnpacked = False
    End Sub
    Public Sub CopyFrom(ByVal so As SfxOptions)
        Me.Name = so.Name
        Me.Version = so.Version
        Me.Copyright = so.Copyright
        Me.Description = so.Description

        Me.Flavor = so.Flavor
        Me.Quiet = so.Quiet
        Me.Title = so.Title
        Me.IconFile = so.IconFile

        Me.CompilerSwitches = so.CompilerSwitches
        Me.Command = so.Command
        Me.ExtractExistingAction = so.ExtractExistingAction
        Me.RemoveUnpacked = so.RemoveUnpacked
    End Sub
    Public Function SfxSaveOptions() As Zip.SelfExtractorSaveOptions
        Dim sso As New Zip.SelfExtractorSaveOptions
        sso.ProductName = Me.Name
        sso.ProductVersion = Me.Version
        sso.Copyright = Me.Copyright
        sso.Description = Me.Description
        sso.Flavor = Me.Flavor
        If sso.Flavor = Zip.SelfExtractorFlavor.ConsoleApplication Then
            sso.Quiet = Me.Quiet
        Else
            sso.SfxExeWindowTitle = Me.Title
            sso.IconFile = Me.IconFile
        End If
        sso.AdditionalCompilerSwitches = Me.CompilerSwitches
        sso.PostExtractCommandLine = Me.Command
        sso.ExtractExistingFile = Me.ExtractExistingAction
        sso.RemoveUnpackedFilesAfterExecute = Me.RemoveUnpacked
        sso.DefaultExtractDirectory = My.Computer.FileSystem.SpecialDirectories.Desktop
        Return (sso)
    End Function

End Class
